<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>OpenDatabase</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">OpenDatabase()</font></b></p>
<p><b>Syntax</b></p><blockquote>

Result = <font color="#006666"><b>OpenDatabase</b></font>(#Database, DatabaseName$, User$, Password$ [, Plugin])  </blockquote>

</blockquote>
<b>Description</b><br><blockquote>



Opens a new database connection. 

 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Database</i></td>
<td width="90%"> 
 
A number to identify the new database. 
<a href="../reference/purebasic_objects.html">#PB_Any</a> can be used to auto-generate this number. 

 

</td></tr>
<tr><td><i>DatabaseName$</i></td>
<td> 
 
The name of the database to open. 

 

</td></tr>
<tr><td><i>User$</i></td>
<td> 
 
The user name for the connection. 

 

</td></tr>
<tr><td><i>Password$</i></td>
<td> 
 
The password for the connection. This can be an empty string if no password is required. 

 

</td></tr>
<tr><td><i>Plugin (optional)</i></td>
<td> 
 
Specifies the database plug-in to use. It can be one of the following value: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Database_ODBC</font>      : The database will use ODBC backend (<a href="useodbcdatabase.html">UseODBCDatabase()</a> has to be called).
  <font color="#924B72">#PB_Database_SQLite</font>    : The database will use SQLite backend (<a href="usesqlitedatabase.html">UseSQLiteDatabase()</a> has to be called).
  <font color="#924B72">#PB_Database_PostgreSQL</font>: The database will use PostgreSQL backend (<a href="usepostgresqldatabase.html">UsePostgreSQLDatabase()</a> has to be called).
</font></pre>

If 'Plugin' isn't specified, then the first registered database plug-in will be used. 

 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>



Returns nonzero if the database connection was established successfully and zero if not. Error information 
can be received with the <a href="databaseerror.html">DatabaseError()</a> command. 
If <font color="#924B72">#PB_Any</font> was used for the #Database parameter, then the generated number is returned. 

 

</blockquote><p><b>See Also</b></p><blockquote>

<a href="opendatabaserequester.html">OpenDatabaseRequester()</a>, <a href="closedatabase.html">CloseDatabase()</a>, 
<a href="useodbcdatabase.html">UseODBCDatabase()</a>, <a href="usesqlitedatabase.html">UseSQLiteDatabase()</a>, <a href="usepostgresqldatabase.html">UsePostgreSQLDatabase()</a> 

</Blockquote><p><b>Supported OS  </b><Blockquote>All</Blockquote></p><center>&lt;- <a href=nextdatabaserow.html>NextDatabaseRow()</a> - <a href=index.html>Database Index</a> - <a href=opendatabaserequester.html>OpenDatabaseRequester()</a> -&gt;



</body></html>